﻿<Application 
    x:Class="MTGenome.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:caliburn="http://www.caliburnproject.org"
    xmlns:Controls="clr-namespace:Caliburn.ShellFramework.Controls;assembly=Caliburn.ShellFramework" 
    xmlns:local="clr-namespace:MTGenome"
    xmlns:ui="clr-namespace:MTGenome.UI;assembly=MTGenome.UI">
    <Application.Resources>
        <ResourceDictionary>
            
            <!--This is required for Caliburn to work in WPF-->
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary>
                    <local:Bootstrapper x:Key="bootstrapper" />
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
            
            <!--Converters-->
            <BooleanToVisibilityConverter x:Key="{x:Type BooleanToVisibilityConverter}" />
            <ui:NullToVisibilityConverter x:Key="{x:Type ui:NullToVisibilityConverter}" />
            <caliburn:EnumConverter x:Key="{x:Type caliburn:EnumConverter}" />
            <!--Default Styles-->
            <Style TargetType="TextBlock">
                <Setter Property="FontSize" Value="16" />
                <Setter Property="TextWrapping" Value="Wrap" />
            </Style>
            <Style TargetType="Image">
                <Setter Property="Stretch" Value="None" />
            </Style>
            <Style TargetType="TextBox">
                <Setter Property="FontSize" Value="16" />
            </Style>
            <Style TargetType="MenuItem">
                <Setter Property="FontSize" Value="16" />
            </Style>
            <Style TargetType="Controls:ButtonPanel"
               x:Key="buttonPanel">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Controls:ButtonPanel">
                            <Border Margin="0 6 0 0">
                                <ItemsPresenter />
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Horizontal"
                                    HorizontalAlignment="Right" />
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="ItemTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <Button Content="{Binding Content}"
                                Margin="2 0 0 0"
                                MinWidth="60"
                                ToolTipService.ToolTip="{Binding ToolTip}"
                                caliburn:Message.Attach="{Binding Action}" />
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style TargetType="Controls:DialogChrome">
                <Setter Property="IsTabStop" 
                    Value="false"/>
                <Setter Property="HorizontalAlignment" 
                    Value="Center"/>
                <Setter Property="VerticalAlignment" 
                    Value="Center"/>
                <Setter Property="HorizontalContentAlignment" 
                    Value="Center"/>
                <Setter Property="VerticalContentAlignment" 
                    Value="Center"/>
                <Setter Property="BorderThickness" 
                    Value="1"/>
                <Setter Property="BorderBrush">
                    <Setter.Value>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FFA3AEB9" Offset="0"/>
                            <GradientStop Color="#FF8399A9" Offset="0.375"/>
                            <GradientStop Color="#FF718597" Offset="0.375"/>
                            <GradientStop Color="#FF617584" Offset="1"/>
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Controls:DialogChrome">
                            <Grid x:Name="Root">
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="WindowStates">
                                        <VisualState x:Name="Open">
                                            <Storyboard>
                                                <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetName="Overlay" Storyboard.TargetProperty="Opacity">
                                                    <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                                    <EasingDoubleKeyFrame KeyTime="00:00:00.3" Value="1"/>
                                                </DoubleAnimationUsingKeyFrames>
                                                <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleX">
                                                    <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
                                                    <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="0"/>
                                                    <SplineDoubleKeyFrame KeyTime="00:00:00.4" Value="1"/>
                                                    <SplineDoubleKeyFrame KeyTime="00:00:00.45" Value="1.05" KeySpline="0,0,0.5,1"/>
                                                    <SplineDoubleKeyFrame KeyTime="00:00:00.55" Value="1"/>
                                                </DoubleAnimationUsingKeyFrames>
                                                <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleY">
                                                    <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
                                                    <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="0"/>
                                                    <SplineDoubleKeyFrame KeyTime="00:00:00.4" Value="1"/>
                                                    <SplineDoubleKeyFrame KeyTime="00:00:00.45" Value="1.05" KeySpline="0,0,0.5,1"/>
                                                    <SplineDoubleKeyFrame KeyTime="00:00:00.55" Value="1"/>
                                                </DoubleAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="Closed">
                                            <Storyboard>
                                                <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetName="Overlay" Storyboard.TargetProperty="Opacity">
                                                    <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                                                    <EasingDoubleKeyFrame KeyTime="00:00:00.3" Value="0"/>
                                                </DoubleAnimationUsingKeyFrames>
                                                <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleX">
                                                    <SplineDoubleKeyFrame KeyTime="00:00:00.2" Value="1"/>
                                                    <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="1.05"/>
                                                    <SplineDoubleKeyFrame KeyTime="00:00:00.45" Value="0"/>
                                                </DoubleAnimationUsingKeyFrames>
                                                <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleY">
                                                    <SplineDoubleKeyFrame KeyTime="00:00:00.2" Value="1"/>
                                                    <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="1.05"/>
                                                    <SplineDoubleKeyFrame KeyTime="00:00:00.45" Value="0"/>
                                                </DoubleAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                                <Grid x:Name="Overlay" 
                                  HorizontalAlignment="Stretch" 
                                  VerticalAlignment="Top" />
                                <Grid x:Name="ContentRoot" 
                                  Height="{TemplateBinding Height}" 
                                  HorizontalAlignment="{TemplateBinding HorizontalAlignment}" 
                                  VerticalAlignment="{TemplateBinding VerticalAlignment}" 
                                  Width="{TemplateBinding Width}" 
                                  RenderTransformOrigin="0.5,0.5">
                                    <Grid.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform/>
                                            <SkewTransform/>
                                            <RotateTransform/>
                                            <TranslateTransform/>
                                        </TransformGroup>
                                    </Grid.RenderTransform>
                                    <Border Background="Black"
                                        CornerRadius="5">
                                        <Border.Effect>
                                            <DropShadowEffect BlurRadius="20" 
                                                          ShadowDepth="0"
                                                          Opacity=".75" />
                                        </Border.Effect>
                                    </Border>
                                    <Border Background="#FFFFFFFF" 
                                        BorderBrush="{TemplateBinding BorderBrush}" 
                                        BorderThickness="{TemplateBinding BorderThickness}" 
                                        CornerRadius="3">
                                        <Border Margin="1" 
                                            CornerRadius="3">
                                            <Border.Background>
                                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                    <GradientStop Color="#FFE5E8EB" Offset="1"/>
                                                    <GradientStop Color="#FFF6F8F9" Offset="0"/>
                                                </LinearGradientBrush>
                                            </Border.Background>
                                            <DockPanel>
                                                <Border x:Name="Chrome" 
                                                    BorderBrush="#FFFFFFFF" 
                                                    BorderThickness="0,0,0,1"
                                                    Padding="0 2 0 2"
                                                    DockPanel.Dock="Top">
                                                    <Border.Background>
                                                        <LinearGradientBrush EndPoint="0.5,0.528" StartPoint="0.5,0">
                                                            <GradientStop Color="#FFE5E8EB" Offset="1"/>
                                                            <GradientStop Color="#FFFEFEFE" Offset="0"/>
                                                        </LinearGradientBrush>
                                                    </Border.Background>
                                                    <ContentControl HorizontalAlignment="Stretch"
                                                                VerticalAlignment="Center"
                                                                FontWeight="Bold"
                                                                IsTabStop="False" 
                                                                Margin="4 0 0 0"
                                                                Content="{TemplateBinding Title}"/>
                                                </Border>
                                                <Controls:ButtonPanel DockPanel.Dock="Bottom"
                                                                  Style="{StaticResource buttonPanel}"
                                                                  Margin="4"
                                                                  Buttons="{TemplateBinding Buttons}" />
                                                <Border Background="{TemplateBinding Background}">
                                                    <ContentPresenter x:Name="ContentPresenter" 
                                                                  Margin="4"
                                                                  HorizontalAlignment="Stretch" 
                                                                  VerticalAlignment="Stretch" 
                                                                  Content="{TemplateBinding Content}" 
                                                                  ContentTemplate="{TemplateBinding ContentTemplate}"/>
                                                </Border>
                                            </DockPanel>
                                        </Border>
                                    </Border>
                                </Grid>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <!--Images-->
            <BitmapImage x:Key="FindIcon" UriSource="/Embed/Find.ico" DecodePixelWidth="16" />
            <BitmapImage x:Key="DeleteIcon" UriSource="/Embed/Delete.ico" DecodePixelWidth="16" />
            <BitmapImage x:Key="SaveIcon" UriSource="/Embed/Save.ico" DecodePixelWidth="16" />
            <BitmapImage x:Key="OpenIcon" UriSource="/Embed/Open.ico" DecodePixelWidth="16" />
            <BitmapImage x:Key="NewIcon" UriSource="/Embed/New.ico" DecodePixelWidth="16" />
            <BitmapImage x:Key="AboutIcon" UriSource="/Embed/About.ico" DecodePixelWidth="16" />
            <BitmapImage x:Key="AddIcon" UriSource="/Embed/Add.ico" DecodePixelWidth="16" />
        
            <!--Special styles-->
            <Style x:Key="Spinner" TargetType="Control">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Control">
                            <ControlTemplate.Resources>
                                <Storyboard x:Key="spinner" RepeatBehavior="Forever">
                                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="bottomCog" Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)">
                                        <EasingDoubleKeyFrame KeyTime="00:00:00" Value="15"/>
                                        <EasingDoubleKeyFrame KeyTime="00:00:00.5000000" Value="195"/>
                                        <EasingDoubleKeyFrame KeyTime="00:00:01" Value="344"/>
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="topCog" Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)">
                                        <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                        <EasingDoubleKeyFrame KeyTime="00:00:00.5000000" Value="-180"/>
                                        <EasingDoubleKeyFrame KeyTime="00:00:01" Value="-359"/>
                                    </DoubleAnimationUsingKeyFrames>
                                </Storyboard>
                            </ControlTemplate.Resources>
                            <Grid>
                                <Grid.Background>
                                    <SolidColorBrush Color="Black" Opacity=".5" />
                                </Grid.Background>
                                <Canvas Height="24" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24">
                                    <Canvas.LayoutTransform>
                                        <ScaleTransform CenterX="12" CenterY="12" ScaleX="2" ScaleY="2" />
                                    </Canvas.LayoutTransform>
                                    <Path x:Name="topCog" Data="M6.1820068,13.326002 C6.1820068,9.1240015 9.6010065,5.7050018 13.804008,5.7050018 C18.005007,5.7050018 21.425007,9.1240015 21.425007,13.326002 C21.425007,17.528002 18.005007,20.947002 13.804008,20.947002 C9.6010065,20.947002 6.1820068,17.528002 6.1820068,13.326002 z M26.226999,13.326 C26.226999,10.769 25.448999,8.3900003 24.118999,6.4120002 L27.768,2.7639999 L25.004,0 L21.455,3.549 C19.344999,1.8940001 16.688,0.90200001 13.804,0.90200001 C10.959,0.90200001 8.3380003,1.865 6.2420001,3.4779999 L2.7639999,0 L0,2.7639999 L3.553,6.316 C2.1830001,8.3129997 1.38,10.727 1.38,13.326 C1.38,16.209999 2.3710001,18.865999 4.026,20.978001 L0,25.004 L2.7639999,27.768 L6.8889999,23.642 C8.8669996,24.972 11.246,25.749001 13.804,25.749001 C16.402,25.749001 18.816,24.945999 20.813,23.576 L25.004,27.768 L27.768,25.004 L23.65,20.888 C25.264,18.791 26.226999,16.169001 26.226999,13.326 z" Fill="White" Stretch="Fill" Height="10" Width="10" UseLayoutRounding="False" Canvas.Left="2.5" Canvas.Top="2.5" RenderTransformOrigin="0.5,0.5">
                                        <Path.RenderTransform>
                                            <RotateTransform/>
                                        </Path.RenderTransform>
                                    </Path>
                                    <Path x:Name="bottomCog" Data="M6.1820068,13.326002 C6.1820068,9.1240015 9.6010065,5.7050018 13.804008,5.7050018 C18.005007,5.7050018 21.425007,9.1240015 21.425007,13.326002 C21.425007,17.528002 18.005007,20.947002 13.804008,20.947002 C9.6010065,20.947002 6.1820068,17.528002 6.1820068,13.326002 z M26.226999,13.326 C26.226999,10.769 25.448999,8.3900003 24.118999,6.4120002 L27.768,2.7639999 L25.004,0 L21.455,3.549 C19.344999,1.8940001 16.688,0.90200001 13.804,0.90200001 C10.959,0.90200001 8.3380003,1.865 6.2420001,3.4779999 L2.7639999,0 L0,2.7639999 L3.553,6.316 C2.1830001,8.3129997 1.38,10.727 1.38,13.326 C1.38,16.209999 2.3710001,18.865999 4.026,20.978001 L0,25.004 L2.7639999,27.768 L6.8889999,23.642 C8.8669996,24.972 11.246,25.749001 13.804,25.749001 C16.402,25.749001 18.816,24.945999 20.813,23.576 L25.004,27.768 L27.768,25.004 L23.65,20.888 C25.264,18.791 26.226999,16.169001 26.226999,13.326 z" Fill="White" Stretch="Fill" Height="10" Width="10" UseLayoutRounding="False" Canvas.Left="11" Canvas.Top="10.25" RenderTransformOrigin="0.5,0.5">
                                        <Path.RenderTransform>
                                            <RotateTransform Angle="15"/>
                                        </Path.RenderTransform>
                                    </Path>
                                </Canvas>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsVisible" Value="True">
                                    <Trigger.EnterActions>
                                        <BeginStoryboard Name="Storyboard" Storyboard="{StaticResource spinner}" />
                                    </Trigger.EnterActions>
                                    <Trigger.ExitActions>
                                        <StopStoryboard BeginStoryboardName="Storyboard" />
                                    </Trigger.ExitActions>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ResourceDictionary>
    </Application.Resources>
</Application>
